<template>
  <div class="container">
    <Breadcrumb :items="['数据分析', '全量数据统计']" />
    <a-card class="general-card" style="padding-top:0px">
      <a-row>
        <a-col :flex="1">
          <a-form :model="formModel" label-align="right">
            <a-row :gutter="16">
              <a-space wrap :size="5">
                <a-form-item field="quarter" label-col-flex="70px"
                  label="问题类别">
                  <a-select v-model="formModel.bigTypeNameList.value" :style="{ width: '240px' }" allow-clear
                    placeholder="全部"
                    allow-search
                    multiple
                    :trigger-props="{ autoFitPopupMinWidth: true }">
                    <a-option :value="item.label" v-for="item in questionList1">{{item.label}}</a-option>
                  </a-select>
                </a-form-item>
                <a-form-item field="userName" label-col-flex="120px" label="清单查摆问题表现">
                  <a-select v-model="formModel.prominentProblemList.value" :style="{ width: '240px' }" allow-clear
                    placeholder="全部"
                    multiple
                    :trigger-props="{ autoFitPopupMinWidth: true }">
                    <a-option :value="item.label" v-for="item in questionList">{{item.label}}</a-option>
                  </a-select>
                </a-form-item>
                <a-form-item field="quarter" label-col-flex="100px"
                  label="突出问题类型">
                  <a-select v-model="formModel.problemTypeList.value" :style="{ width: '160px' }" allow-clear
                    placeholder="全部"
                    allow-search
                    multiple
                    :trigger-props="{ autoFitPopupMinWidth: true }">
                    <a-option :value="item.label" v-for="item in questionList2">{{item.label}}</a-option>
                  </a-select>
                </a-form-item>
                <!-- 牵头领导、查处违纪违法案件（有/无）、组织处理（有/无）、纪律处分（有/无）、印发通报（有/无）、发出执纪执法建议（文书）（有/无） -->
                

                <a-form-item field="department" label-col-flex="70px" label="牵头领导">
                  <a-select v-model="formModel.departmentList.value" placeholder="请选择牵头领导" :style="{ width: '160px' }"
                    allow-clear
                    multiple
                    allow-search>
                    <a-option v-for="item in departmentList" :key="item.id" :value="item.department">{{ item.department }}</a-option>
                  </a-select>
                </a-form-item>
                <a-form-item field="department" label-col-flex="70px" label="责任单位">
                  <a-select v-model="formModel.departmentList.value" placeholder="请选择责任单位" :style="{ width: '160px' }"
                    allow-clear
                    multiple
                    allow-search>
                    <a-option v-for="item in departmentList" :key="item.id" :value="item.department">{{ item.department }}</a-option>
                  </a-select>
                </a-form-item>

                <a-form-item field="department" label-col-flex="70px" label="查处违纪违法案件">
                  <a-select v-model="formModel.departmentList.value" placeholder="请选择有/无" :style="{ width: '160px' }"
                    allow-clear>
                    <a-option value="1">有</a-option>
                    <a-option value="0">无</a-option>
                  </a-select>
                </a-form-item>
                <a-form-item field="department" label-col-flex="70px" label="纪律处分">
                  <a-select v-model="formModel.departmentList.value" placeholder="请选择有/无" :style="{ width: '160px' }"
                    allow-clear>
                    <a-option value="1">有</a-option>
                    <a-option value="0">无</a-option>
                  </a-select>
                </a-form-item>

                <a-form-item field="department" label-col-flex="70px" label="组织处理">
                  <a-select v-model="formModel.departmentList.value" placeholder="请选择有/无" :style="{ width: '160px' }"
                    allow-clear>
                    <a-option value="1">有</a-option>
                    <a-option value="0">无</a-option>
                  </a-select>
                </a-form-item>

                <a-form-item field="department" label-col-flex="70px" label="印发通报">
                  <a-select v-model="formModel.departmentList.value" placeholder="请选择有/无" :style="{ width: '160px' }"
                    allow-clear>
                    <a-option value="1">有</a-option>
                    <a-option value="0">无</a-option>
                  </a-select>
                </a-form-item>

                <a-form-item field="department" label-col-flex="100px" label="发出执纪执法建议（文书）">
                  <a-select v-model="formModel.departmentList.value" placeholder="请选择有/无" :style="{ width: '160px' }"
                    allow-clear>
                    <a-option value="1">有</a-option>
                    <a-option value="0">无</a-option>
                  </a-select>
                </a-form-item>

                <a-form-item field="quarter" label-col-flex="70px"
                  label="创建日期">
                  <a-range-picker
                    v-model="formModel.dateRange.value"
                    mode="date"
                    style="width: 240px;"
                  />
                </a-form-item> 

                <a-form-item field="quarter" label-col-flex="70px"
                  label="完成时限">
                  <a-range-picker
                    v-model="formModel.dateRange2.value"
                    mode="date"
                    style="width: 240px;"
                  />
                </a-form-item> 

                <a-form-item label-col-flex="0px" label="">
                  <a-space direction="horizontal" :size="12">
                    <a-button status="success" @click="fetchData">
                      <template #icon>
                        <icon-search />
                      </template>
                      查询
                    </a-button>
                  </a-space>
                </a-form-item>
              </a-space>
            </a-row>
          </a-form>
        </a-col>
      </a-row>
      <a-table :data="renderData" :columns="columns" :pagination="true" :scrollbar="true"
        :scroll="{ x: '3200px', y: '80vh' }" :bordered="{cell:true}"
        :body-cell-style="bodyCellClass"
        :summary-span-method="spanMethod"  :summary="summary">
        <template #summary-cell="{ column, record, rowIndex }">
          <span>{{ record[column.dataIndex] }}</span>
        </template>
        <!-- rectification -->
        <!-- remark -->
         <template #remark="{ rowIndex,record }"> 
            <a-tooltip :content="record.remark" position="top" mini
              style="display: flex;
              height: 70px;
              align-items: center;"  
            >
                <span style="
                text-align: left;
                width: 220px;
                height: 70px;
                display: block;
                -webkit-line-clamp: 3;
                overflow: hidden;">{{record.remark}}</span>
            </a-tooltip>
         </template>
         <template #rectification="{ rowIndex,record }"> 
            <a-tooltip :content="record.rectificationMeasures" position="top" mini
              style="display: flex;
              height: 70px;
              align-items: center;"  
            >
                <span style="
                text-align: left;
                width: 220px;
                height: 70px;
                display: block;
                -webkit-line-clamp: 3;
                overflow: hidden;">{{record.rectificationMeasures}}</span>
            </a-tooltip>
        </template>
        <template #circular="{ rowIndex }"> 
          <div
            style="width: 156px;margin-left:-15px;height:25px;line-height:25px;"
            v-for="item,index in renderData[rowIndex].circularIssuesList" 
            :style="{borderBottom: index === renderData[rowIndex].circularIssuesList.length - 1 ? 'none' : '1px solid #cccccc'}"
            :key="index">
            <a-tooltip :content="item.no" position="top" mini>
              <span style="overflow: hidden;text-overflow: ellipsis;display: block;width: 160px;height: 30px;">{{item.no}}</span>
            </a-tooltip>
          </div>
        </template>
        <template #circularnum="{ rowIndex }"> 
          <div
            style="width: 112px;margin-left:-15px;height:25px;line-height:25px;"
            v-for="item,index in renderData[rowIndex].circularIssuesList" 
            :style="{borderBottom: index === renderData[rowIndex].circularIssuesList.length - 1 ? 'none' : '1px solid #cccccc'}"
            :key="index">
            <span>{{item.value}}</span>
          </div>
        </template>
        <template #established="{ rowIndex }"> 
          <div>
            <div v-for="item,index in renderData[rowIndex].establishedNameList" 
            style="width: 168px;margin-left:-15px;height:25px;line-height:25px;"
            :style="{borderBottom: index === renderData[rowIndex].establishedNameList.length - 1 ? 'none' : '1px solid #cccccc'}"  
            :key="index">
              <a-tooltip :content="item.name" position="top" mini>
                <span style="overflow: hidden;text-overflow: ellipsis;display: block;width: 160px;height: 30px;">{{item.name}}</span>
              </a-tooltip>
            </div>
          </div>
        </template>
      </a-table>
    
    </a-card>


   
  </div>
</template>
<script lang="ts" setup>import { ref, reactive } from 'vue';
import { Modal, Message } from '@arco-design/web-vue';
import '@arco-design/web-vue/dist/arco.css'; // 确保引入了样式文件
import { postRequest, uploadFileRequest } from '@/api/common';
import { baseURL } from '@/api/base';
import dayjs from 'dayjs';

const formModel = {
  department: ref<any>(""),
  departmentList: ref<any[]>([]),
  bigTypeNameList: ref<any[]>([]),
  prominentProblemList: ref<any[]>([]),
  problemTypeList: ref<any[]>([]),
  isTopTen: ref(""),
  dateRange: ref<any[]>([]),
  dateRange2: ref<any[]>([]),
  pageNum: 1,
  pageSize: 10
};
formModel.department.value = undefined;

const fieldNames = {value: 'value', label: 'label'}
const questionList:any[] = [
  {
    label: "“民生小案”破案",value: "101",
    children: [{ label: "不担当不作为、推诿扯皮问题",value: "1" }]
  },
  {
    label: "命案防范",value: "102",
    children: [{ label: "不担当不作为、推诿扯皮问题",value: "2" }]
  },
  {
    label: "矛盾纠纷实质性化解",value: "103",
    children: [{ label: "不担当不作为、推诿扯皮问题",value: "3" }]
  },
  {
    label: "执行难破解难",value: "104",
    children: [{ label: "不担当不作为、推诿扯皮问题",value: "4" }]
  },
  {
    label: "后进村整顿",value: "105",
    children: [{ label: "不担当不作为、推诿扯皮问题",value: "5" }]
  },
  {
    label: "行政村布局调整“后半篇”文章",value: "106",
    children: [{ label: "不担当不作为、推诿扯皮问题",value: "6" }]
  },
  {
    label: "12345投诉办理不及时",value: "107",
    children: [{ label: "不担当不作为、推诿扯皮问题",value: "7" }]
  },
  {
    label: "不担当不作为集中整治处理中其它突出问题",value: "108",
    children: [{ label: "不担当不作为、推诿扯皮问题",value: "8" }]
  },
  {
    label: "政绩观偏差、搞“面子工程”问题",value: "109",
    children: [{ label: "政绩观偏差、搞“面子工程”问题",value: "9" }]
  },
  {
    label: "执行政策“一刀切”、层层加码问题",value: "110",
    children: [{ label: "执行政策“一刀切”、层层加码问题",value: "10" }]
  },
  {
    label: "文风会风不实、搞文山会海问题",value: "111",
    children: [{ label: "文风会风不实、搞文山会海问题",value: "11" }]
  },
  {
    label: "整治形式主义为基层减负存在差距问题",value: "112",
    children: [{ label: "整治形式主义为基层减负存在差距问题",value: "12" }]
  },
  {
    label: "未成年人保护和预防犯罪",value: "113",
    children: [{ label: "漠视群众、脱离群众、侵害群众利益问题",value: "13" }]
  },
  {
    label: "道路交通安全综合治理",value: "114",
    children: [{ label: "漠视群众、脱离群众、侵害群众利益问题",value: "14" }]
  },
  {
    label: "精神障碍患者服务管理",value: "115",
    children: [{ label: "漠视群众、脱离群众、侵害群众利益问题",value: "15" }]
  },
  {
    label: "电信网络诈骗打击",value: "116",
    children: [{ label: "漠视群众、脱离群众、侵害群众利益问题",value: "16" }]
  },
  {
    label: "禁毒工作",value: "117",
    children: [{ label: "漠视群众、脱离群众、侵害群众利益问题",value: "17" }]
  },
  {
    label: "新就业群体“急难愁盼”",value: "118",
    children: [{ label: "漠视群众、脱离群众、侵害群众利益问题",value: "18" }]
  },
  {
    label: "高额彩礼",value: "119",
    children: [{ label: "漠视群众、脱离群众、侵害群众利益问题",value: "19" }]
  },
  {
    label: "外籍新娘管理服务",value: "120",
    children: [{ label: "漠视群众、脱离群众、侵害群众利益问题",value: "20" }]
  },
  {
    label: "失能失智老人日间照护",value: "121",
    children: [{ label: "漠视群众、脱离群众、侵害群众利益问题",value: "21" }]
  },
  {
    label: "留守妇女就业",value: "122",
    children: [{ label: "漠视群众、脱离群众、侵害群众利益问题",value: "22" }]
  },
  {
    label: "留守儿童假期托管",value: "123",
    children: [{ label: "漠视群众、脱离群众、侵害群众利益问题",value: "23" }]
  },
  {
    label: "慢性病老人心电图“一张网”",value: "124",
    children: [{ label: "漠视群众、脱离群众、侵害群众利益问题",value: "24" }]
  },
  {
    label: "中小学生午休“趴睡”变“躺睡”",value: "125",
    children: [{ label: "漠视群众、脱离群众、侵害群众利益问题",value: "25" }]
  },
  {
    label: "市区老年人娱乐场所建设",value: "126",
    children: [{ label: "漠视群众、脱离群众、侵害群众利益问题",value: "26" }]
  },
  {
    label: "“群腐”集中整治处理中其他突出问题",value: "127",
    children: [{ label: "漠视群众、脱离群众、侵害群众利益问题",value: "27" }]
  },
  {
    label: "违规吃喝问题",value: "128",
    children: [{ label: "违规吃喝问题",value: "28" }]
  },
  {
    label: "违规收送礼品礼金问题",value: "129",
    children: [{ label: "违规收送礼品礼金问题",value: "29" }]
  },
  {
    label: "借调研培训等名义公款旅游问题",value: "130",
    children: [{ label: "借调研培训等名义公款旅游问题",value: "30" }]
  },
  {
    label: "违规建设、奢华装修楼堂馆所问题",value: "131",
    children: [{ label: "违规建设、奢华装修楼堂馆所问题",value: "31" }]
  },
  {
    label: "开展照顾性、无实质内容的一般性出国（境）活动问题",value: "132",
    children: [{ label: "开展照顾性、无实质内容的一般性出国（境）活动问题",value: "32" }]
  },
  {
    label: "酒驾醉驾问题",value: "133",
    children: [{ label: "酒驾醉驾问题",value: "33" }]
  },
  {
    label: "违规打牌和赌博问题",value: "134",
    children: [{ label: "违规打牌和赌博问题",value: "34" }]
  },
  {
    label: "化解疑难信访积案",value: "135",
    children: [{ label: "化解疑难信访积案",value: "35" }]
  },
  {
    label: "中小学“校园餐”等领域侵害群众利益问题",value: "136",
    children: [{ label: "中小学“校园餐”等领域侵害群众利益问题",value: "36" }]
  },
  {
    label: "公共交通服务质量不优的问题",value: "137",
    children: [{ label: "公共交通服务质量不优的问题",value: "37" }]
  },
  {
    label: "物业服务履约不到位、侵害业主公共收益问题",value: "138",
    children: [{ label: "物业服务履约不到位、侵害业主公共收益问题",value: "38" }]
  },
  {
    label: "大气污染治理问题",value: "139",
    children: [{ label: "大气污染治理问题",value: "39" }]
  }
];
// 建章立制类、存量化解类、新增问题类、试点类、其他类
const questionList1 :any[] = [
  {
    label: "建章立制类",
    value: "建章立制类"
  },
  {
    label: "存量化解类",
    value: "存量化解类"
  },
  {
    label: "新增问题类",
    value: "新增问题类"
  },
  {
    label: "试点类",
    value: "试点类"
  },
  {
    label: "其他类",
    value: "其他类"
  }
];

const questionList2:any[] = [
  {
    label: "不担当不作为、推诿扯皮问题"
  },
  {
    label: "政绩观偏差、搞“面子工程”问题"
  },
  {
    label: "执行政策“一刀切”、层层加码问题"
  },
  {
    label: "文风会风不实、搞文山会海问题"
  },
  {
    label: "整治形式主义为基层减负存在差距问题"
  },
  {
    label: "漠视群众、脱离群众、侵害群众利益问题"
  },
  {
    label: "违规吃喝问题"
  },
  {
    label: "违规收送礼品礼金问题"
  },
  {
    label: "借调研培训等名义公款旅游问题"
  },
  {
    label: "违规建设、奢华装修楼堂馆所问题"
  },
  {
    label: "开展照顾性、无实质内容的一般性出国（境）活动问题"
  },
  {
    label: "酒驾醉驾问题"
  },
  {
    label: "违规打牌和赌博问题"
  },
  {
    label: "化解疑难信访积案"
  },
  {
    label: "中小学“校园餐”等领域侵害群众利益问题"
  },
  {
    label: "公共交通服务质量不优的问题"
  },
  {
    label: "物业服务履约不到位、侵害业主公共收益问题"
  },
  {
    label: "大气污染治理问题"
  }
];

const  departmentList = ref<any[]>([]);

let totalSize = ref(10);

// 
const toLeadVisible = ref(false);
//fileFlag
const upLoadFileFlag = ref(false);
//toLeadForm 上传文件
let toLeadForm: FormData = new FormData();

let sumData = reactive({
    index: '合计',
    problemsFoundCount: 0,
    closedCount: 0 as any,
    inProgressCount: 0,
    disciplinaryCases: 0,
    punishedPersons: 0,
    disciplinaryPunishedPersons:0,
    circularIssues: 0 as any,
    recommendationLetters: 0,
    establishedSystems:0
  })
  const summary = () => {
    return [sumData]
  }
  

  
const spanMethod = ({rowIndex, columnIndex}) =>{
  if(rowIndex == 0 && columnIndex == 0){
    return {
        colspan: 2
      }
  }
}

const bodyCellClass = ({rowIndex, columnIndex}) =>{
  return {
      backgroundColor: 'red'
    }
}

const columns:any = reactive([
    {
      title: '序号',
      dataIndex:'index',
      align: 'center',
      fixed: 'left',
      width: 60,
    },
    {
      title: '清单查摆问题表现',
      dataIndex:'prominentProblem',
      align: 'center',
      width: 140,
    },
    {
      title: '突出问题类型',
      dataIndex:'problemType',
      align: 'center',
      width: 140,
    },
    {
      title: '问题类别',
      dataIndex:'bigTypeName',
      align: 'center',
      width: 100,
    },
    {
      title: '整改措施',
      dataIndex:'rectificationMeasures',
      align: 'center',
      slotName: 'rectification',
      width: 220,
    },
    {
        title: '整治责任',
        dataIndex: 'department',
        align: 'center',
        width: 240,
        children:[
          {
            title: '责任单位',
            dataIndex:'department',
            align: 'center',
            ellipsis: true,
            tooltip: true,
            width: 120,
          },
          {
            title: '牵头领导',
            dataIndex:'responsibleLeader',
            align: 'center',
            ellipsis: true,
            tooltip: true,
            width: 100,
          },
          {
            title: '分管领导',
            dataIndex:'supervisingLeader',
            align: 'center',
            ellipsis: true,
            tooltip: true,
            width: 100,
          }
        ]
    },
    {
      title: '完成时限',
      dataIndex:'completionDeadline',
      align: 'center',
      ellipsis: true,
      tooltip: true,
      width: 140,
    },

    {
      title: '进展成效',
      dataIndex: 'label',
      align: 'center',
      width: 1300,
      children:[{
        title: '自查自纠发现问题数',
        dataIndex: 'problemsFoundCount',
        align: 'center',
        width: 120,
        bodyCellStyle: (record) =>{
          return {
            backgroundColor: '#dcb35360'
          }
        }
      },{
        title: '已整治销号',
        dataIndex: 'closedCount',
        align: 'center',
        width: 120,
        bodyCellStyle: (record) =>{
          return {
            backgroundColor: '#dcb35360'
          }
        }
      },{
        title: '整治处理中',
        dataIndex: 'inProgressCount',
        align: 'center',
        width: 120,
        bodyCellStyle: (record) =>{
          return {
            backgroundColor: '#dcb35360'
          }
        }
      },{
        title: '建立制度数',
        dataIndex: 'establishedSystems',
        align: 'center',
        width: 90,
      },{
        title: '制度名称',
        dataIndex: 'establishedName',
        align: 'center',
        width: 150,
        slotName: 'established'
      },
      {
        title: '查处违纪违法案件数',
        dataIndex: 'disciplinaryCases',
        align: 'center',
        width: 120,
        bodyCellStyle: (record) =>{
          return {
            backgroundColor: '#8ccd8c60'
          }
        }
      },{
        title: '组织处理人数',
        dataIndex: 'punishedPersons',
        align: 'center',
        width: 120,
        bodyCellStyle: (record) =>{
          return {
            backgroundColor: '#8ccd8c60'
          }
        }
      },{
        title: '纪律处分人数',
        dataIndex: 'disciplinaryPunishedPersons',
        align: 'center',
        width: 120,
        bodyCellStyle: (record) =>{
          return {
            backgroundColor: '#8ccd8c60'
          }
        }
      },{
        title: '印发通报编号',
        dataIndex: 'circularNo',
        align: 'center',
        width: 140,
        slotName: 'circular'
      },
      {
        title: '通报涉及本单位问题数',
        dataIndex: 'circularIssues',
        align: 'center',
        width: 100,
        slotName: 'circularnum'
      },
      {
        title: '发出执纪执法建议（文书）数',
        dataIndex: 'recommendationLetters',
        align: 'center',
        width: 140,
      },
      {
        title: '其他情况',
        dataIndex: 'remark',
        align: 'center',
        slotName: 'remark',
        width: 120,
      },
    ]  
    },
    {
      title: '是否属于“十大攻坚”',
      dataIndex: 'isTopTen',
      align: 'center',
      width: 100,
    },
  ]);


const editvisible = ref(false);
const editDataForm = { 
  id: ref(0),
  bigTypeName:ref(""),
  prominentProblem: ref(""),
  problemType: ref(""),
  bigTypeNameList:  ref<any[]>(),
  remark: ref(""),
  supervisingLeader: ref(""),
  rectificationMeasures: ref(""),
  department: ref(""),
  responsibleLeader: ref(""),
  completionDeadline: ref(""),
  problemsFoundCount: ref(0),
  closedCount: ref(0),
  inProgressCount: ref(0),
  disciplinaryCases: ref(0),
  punishedPersons: ref(0),
  disciplinaryPunishedPersons: ref(0),
  recommendationLetters: ref(0),
  circularIssues: ref(0),
  circularNo: ref(""),
  circularIssuesList: ref<any[]>([
    reactive({
      no:'',
      value:''
    })
  ]),
  establishedSystems: ref(0),
  establishedName: ref(""),
  establishedNameList: ref<any[]>([]),
  isTopTen: ref(0)
}



const department = localStorage.getItem("department");
let role = localStorage.getItem("userRole");
// if(role != 'admin'){
//   formModel.department.value = department as string;
// }

let renderData = ref<any[]>([]);


const fetchData = async () => {
  // let startTime = "";
  // let endTime = "";
  // if(formModel.dateRange.value!=null && formModel.dateRange.value.length>1){
  //   startTime = formModel.dateRange.value[0];
  //   endTime = formModel.dateRange.value[1];
  // }
  sumData.problemsFoundCount = 0;
  sumData.closedCount = 0;
  sumData.inProgressCount = 0;
  sumData.disciplinaryCases = 0;
  sumData.punishedPersons = 0;
  sumData.disciplinaryPunishedPersons = 0;
  sumData.recommendationLetters = 0;
  sumData.circularIssues = 0;
  sumData.establishedSystems = 0;
  let res = await postRequest("dsms/jyData/queryProblemManagementPage", {
    prominentProblemList:formModel.prominentProblemList.value,
    problemTypeList:formModel.problemTypeList.value,
    bigTypeNameList:formModel.bigTypeNameList.value,
    department:formModel.department.value,
    pageNum: 1,
    pageSize: 9999
  });
  res.list.forEach((item:any,index:number)=>{
    item.index = index + 1;
    sumData.problemsFoundCount = sumData.problemsFoundCount + item.problemsFoundCount;;
    sumData.closedCount = sumData.closedCount + item.closedCount;
    sumData.inProgressCount = sumData.inProgressCount + item.inProgressCount;
    sumData.disciplinaryCases = sumData.disciplinaryCases + item.disciplinaryCases;
    sumData.punishedPersons = sumData.punishedPersons + item.punishedPersons;
    sumData.disciplinaryPunishedPersons = sumData.disciplinaryPunishedPersons + item.disciplinaryPunishedPersons;
    sumData.recommendationLetters = sumData.recommendationLetters + item.recommendationLetters;
    sumData.circularIssues = sumData.circularIssues + item.circularIssues;
    sumData.establishedSystems = sumData.establishedSystems + item.establishedSystems;

    if(item.circularNo.length>1 && item.circularNo.indexOf("[") != -1){
        item.circularIssuesList = JSON.parse(item.circularNo);
        item.circularIssuesList = item.circularIssuesList.filter(issue => 
          issue.no != null && String(issue.no).trim().length > 0
        );
        //去掉为空的和长度小于1的
        //&& item.no.length>1){
          // item.circularIssuesList =  item.circularIssuesList.filter(item => item.no && item.no.trim())
          // item.circularIssuesList = item.filter((item:any) => item.no.length>1);

    }else{
        item.circularIssuesList = [
          {
            no: item.circularNo,
            value: item.circularIssues
          }
        ]
    }

    if(item.establishedName.length>1 && item.establishedName.indexOf("[") != -1){
        item.establishedNameList = JSON.parse(item.establishedName);
        item.establishedNameList = item.establishedNameList.filter(issue => 
          issue.name != null && String(issue.name).trim().length > 0
        );
          // item.establishedNameList = item.filter((item:any) => item.name.length>1);
    }else{
        item.establishedNameList = [
          {
            name: item.establishedName
          }
        ]
    }

    // try {
    //   item.circularIssuesList = JSON.parse(item.circularNo);
    //   console.log(item.circularIssuesList);
    // } catch (error) {
    //   item.circularIssuesList = [
    //     // {
    //     //   no:"",
    //     //   value:""
    //     // }
    //   ];
    // }
    // try {
    //   item.establishedNameList = JSON.parse(item.establishedName);
    // } catch (error) {
    //   item.establishedNameList = [
    //     // {
    //     //   name:"",
    //     // }
    //   ];
    // }
    item.createdTime = item.createdTime.substring(0,10);
    item.isTopTen = item.isTopTen == 1 ? "是" : "否";
    item.department = (item.department != null && item.department != 'null')  ? item.department : "";
  })
  renderData.value = res.list;
  totalSize.value = Number(res.total);
}
function jumpPage(val: any) {
  formModel.pageNum = val;
  fetchData();
}

const fetchDepartment = async () => { 
  // departmentList
  let res = await postRequest("dsms/jyData/getUserList", {
    pageSize:999
  });
  // 将res 去重 根据department 去重
  res = res.filter((item: any, index: number, self: any) => {
    return self.findIndex((t: any) => t.department === item.department) === index;
  });
  // 去掉部门为县市区的
  const excludedCounties = ['黄州区', '团风县', '红安县', '麻城市', '罗田县', '英山县', '浠水县', '蕲春县', '武穴市', '黄梅县', '龙感湖', '白莲河'];
  res = res.filter((item:any) => !excludedCounties.includes(item.department));
  departmentList.value = res;
};

fetchDepartment();
fetchData();
</script>
<script lang="ts">
export default {
  name: 'dataUpload',
};
</script>
<style scoped lang="less">
::v-deep(.arco-upload-progress){
  visibility: hidden;
}
.container {
  padding: 0 20px 20px 20px;
}
::v-deep(.arco-form-item){
  margin-bottom: 10px;
}
.bg-color-yellow{
  color:yellow;
}
</style>